<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>05流程控制</title>
</head>
<body>
<script>
    //1.顺序结构
    console.log("1");
    console.log("2");
    console.log("3");
    //2.if分支结构
    let name = ''; //"" 空串为flase
    if (!name){
         document.write('不能为空');
    }else {
         document.write(name+"回来");
    }
    //3.选择结构 switch
    let month = 10;
    switch (month){
        case 1:
        case 2:
        case 3:
            document.write("春季");
            break;
        case 4:
        case 5:
        case 6:
            document.write("夏季");
            break;
        default:
          document.write("其他");
          break;
    }
    //4.循环结构
    let num = [1,2,3,4,5,6,7,8,9,10]
    for (var i = 0; i < 10; i++) {
        document.write(num[i]+ '<br>');
    }
    //let是局部定义,var是全局定义
    console.log(i);
    for(let n of num){
        document.write(n+ '<br>');
    }
</script>
</body>
</html>